Editor.Shapes.Property = function (u, ui, ue, i) {
	if (i == undefined) {
		i = this;
	}
	Editor.Shapes.Resource.call(this, u, i);

	this.uuidIni = ui;
	this.uuidEnd = ue;
	Editor.STATE.SHAPES.get(this.uuidIni).addInProperties(u);
	Editor.STATE.SHAPES.get(this.uuidEnd).addInProperties(u);
}

Editor.Util.inherits(Editor.Shapes.Property, Editor.Shapes.Resource);

Editor.Shapes.Property.prototype.draw = function () {
	Editor.Shapes.Property.superClass_.draw.call(this);
	this.toFront();
	//this._resize(Editor.CONFIG.PROPERTY_SHAPE_WIDTH - this.getWidth(), Editor.CONFIG.PROPERTY_SHAPE_HEIGHT - this.getHeight());
}

Editor.Shapes.Property.prototype._remove = function () {
	Editor.Shapes.Property.superClass_._remove.call(this);
}

Editor.Shapes.Property.prototype.remove = function () {
	var impl = this;
	var arrConnections = new Array();

	var cmd = new JS.Command({
		execute: function () {
			Editor.Shapes.Property.superClass_.remove.call(impl);
			Editor.Util.removeConnections(impl.getUuid(),arrConnections);
		},
		undo: function () {
			impl.draw();
			Editor.Util.unremoveConnections(arrConnections);
		},
		stack: Editor.STATE.CMDSTACK
	});
	cmd.name = 'remove property';
	cmd.execute();
}

Editor.Shapes.Property.prototype.toFront = function () {
	Editor.Shapes.Property.superClass_.toFront.call(this, this);
}

Editor.Shapes.Property.prototype.moveTo = function (x, y) {
	Editor.Shapes.Property.superClass_.moveTo.call(this, x, y);
}

Editor.Shapes.Property.prototype.translate = function (dx, dy) {
	Editor.Shapes.Property.superClass_._translate.call(this, dx, dy);
}

Editor.Shapes.Property.prototype._resize = function (dw, dh) {
	Editor.Shapes.Property.superClass_._resize.call(this, dw, dh);
}

Editor.Shapes.Property.prototype.resize = function (dw, dh) {
	Editor.Shapes.Property.superClass_.resize.call(this, dw, dh);
}

// get
Editor.Shapes.Property.prototype.getTypeClass = function () {
	return "property";
}

Editor.Shapes.Property.prototype.getInfo = function () {
	var str = '';
	if (Editor.CONFIG.DEBUG) {
		str = 'Property:\n';
		str += 'uuidIni: ' + this.uuidIni + '\n';
		str += 'uuidEnd: ' + this.uuidEnd + '\n';
		str += '---------------\n';
	}
	str += Editor.Shapes.Property.superClass_.getInfo.call(this);
	return str;
}

Editor.Shapes.Property.prototype.getFigure = function () {
	return Editor.STATE.CANVAS.rect(this.getX(), this.getY(), this.getWidth(), this.getHeight(), Editor.CONFIG.PROPERTY_SHAPE_ROUNDED).
	attr(Editor.CONFIG.PROPERTY_SHAPE_ATTR);
}

Editor.Shapes.Property.prototype.getShapeAttr = function () {
	return Editor.CONFIG.PROPERTY_SHAPE_ATTR;
}

Editor.Shapes.Property.prototype.toObject = function () {
	return {
		'type': 'property',
		'uuidIni': this.uuidIni,
		'uuidEnd': this.uuidEnd,
		'resource': Editor.Shapes.Property.superClass_.toObject.call(this)
	}
}

Editor.Shapes.Property.prototype.getUuidIni = function () {
	return this.uuidIni;
}

Editor.Shapes.Property.prototype.getUuidEnd = function () {
	return this.uuidEnd;
}

// event
Editor.Shapes.Property.prototype.mouseover = function () {
	if (!Editor.Util.isDragging()) {
		Editor.Shapes.Property.superClass_.mouseover.call(this.impl);
	}
}

Editor.Shapes.Property.prototype.mouseout = function () {
	if (!Editor.Util.isDragging()) {
		Editor.Shapes.Property.superClass_.mouseout.call(this.impl);
	}
}

Editor.Shapes.Property.prototype.mousedown = function (e) {
	if (!Editor.Util.isDragging()) {
		Editor.Shapes.Property.superClass_.mousedown.call(this.impl, e);
	}
}

Editor.Shapes.Property.prototype.click = function () {
	if (!Editor.Util.isDragging()) {
		Editor.Shapes.Property.superClass_.click.call(this.impl);
	}
}

Editor.Shapes.Property.prototype.onmouseup = function () {
	Editor.Shapes.Property.superClass_.onmouseup.call(this.impl);
}
